package com.jrzh.mvc.search.sys;

import org.apache.commons.lang.StringUtils;

import com.jrzh.common.utils.DateUtil;
import com.jrzh.framework.base.search.BaseSearch;
import com.jrzh.framework.searchutils.Criteria;
import com.jrzh.framework.searchutils.Restrictions;

public class LoginLogSearch extends BaseSearch{
	private static final long serialVersionUID = 1L;
	private String likeUserName;
	private String likeMac;
	private String leTime;
	private String geTime;
	private Integer eqType;
	
	@Override
	public void setCriterias(Criteria<?> criterias) {
		if(StringUtils.isNotBlank(likeUserName)){
			criterias.add(Restrictions.like("user.name", "%"+likeUserName+"%"));
		}
		if(StringUtils.isNotBlank(likeMac)){
			criterias.add(Restrictions.like("macAddress", "%"+likeMac+"%"));
		}
		if(StringUtils.isNotBlank(leTime)){
			criterias.add(Restrictions.lte("createTime", DateUtil.format(leTime + " 23:59:59")));
		}
		if(StringUtils.isNotBlank(geTime)){
			criterias.add(Restrictions.gte("createTime",  DateUtil.format(geTime + " 00:00:00")));
		}
		if(null !=eqType){
			criterias.add(Restrictions.eq("type", eqType));
		}
	}
	
	
	public Integer getEqType() {
		return eqType;
	}


	public void setEqType(Integer eqType) {
		this.eqType = eqType;
	}


	public String getLikeMac() {
		return likeMac;
	}


	public void setLikeMac(String likeMac) {
		this.likeMac = likeMac;
	}


	public String getLeTime() {
		return leTime;
	}


	public void setLeTime(String leTime) {
		this.leTime = leTime;
	}


	public String getGeTime() {
		return geTime;
	}


	public void setGeTime(String geTime) {
		this.geTime = geTime;
	}


	public String getLikeUserName() {
		return likeUserName;
	}
	public void setLikeUserName(String likeUserName) {
		this.likeUserName = likeUserName;
	}


}